package com.ntt.benew.dictionary.entity.gpt

import android.os.Parcel
import android.os.Parcelable
import androidx.annotation.Keep
import com.google.gson.annotations.SerializedName

@Keep
data class CoreWordEntity(
    val word: String? = null,
    var image: String? = null,
    val lemma : String? = null,
    @field:SerializedName("translation")
    val translate: String? = null,
    val prototype: String? = null,
    @field:SerializedName("speech_part")
    val partSpeech: String? = null,
    var voice: String? = null,
    var isPlaying: Boolean = false
) : Parcelable {
    constructor(parcel: Parcel) : this(
        parcel.readString(),
        parcel.readString(),
        parcel.readString(),
        parcel.readString(),
        parcel.readString(),
        parcel.readString(),
        parcel.readString(),
        parcel.readByte() != 0.toByte()
    ) {
    }

    override fun writeToParcel(parcel: Parcel, flags: Int) {
        parcel.writeString(word)
        parcel.writeString(image)
        parcel.writeString(lemma)
        parcel.writeString(translate)
        parcel.writeString(prototype)
        parcel.writeString(partSpeech)
        parcel.writeString(voice)
        parcel.writeByte(if (isPlaying) 1 else 0)
    }

    override fun describeContents(): Int {
        return 0
    }

    companion object CREATOR : Parcelable.Creator<CoreWordEntity> {
        override fun createFromParcel(parcel: Parcel): CoreWordEntity {
            return CoreWordEntity(parcel)
        }

        override fun newArray(size: Int): Array<CoreWordEntity?> {
            return arrayOfNulls(size)
        }
    }
}